package flash.sound.audio.buffer {
  import flash.sound.audio.format.AudioFormat;
  import flash.sound.audio.format.IAudioFormat;
  import flash.utils.ByteArray;
  import flash.utils.Endian;
  import flash.utils.getTimer;
  
  /**
  *
  */
  public class AudioBuffer implements IAudioBuffer {
    
    /**
    * 
    */
    private var _id: String = "buffer_" + getTimer();
    
    /**
    * 
    */
    private var _data: ByteArray = new ByteArray();

    /**
    * 
    */
    private var _audioFormat: IAudioFormat = new AudioFormat();
    
    /**
    * 
    */
    public function set id(value: String): void {
      _id =value;
    }
    
    /**
    * 
    */
    public function get id(): String {
      return _id;
    }

    /**
    * 
    */
    public function set data(value: ByteArray): void {
      _data = value;
    }
    
    /**
    * 
    */
    public function get data(): ByteArray {
      return _data;
    }
    
    /**
    * 
    */
    public function set audioFormat(value: IAudioFormat): void {
      _audioFormat = value;
    }
    
    /**
    * 
    */
    public function get audioFormat(): IAudioFormat {
      return _audioFormat;
    }
    
    /**
    * 
    */
    public function AudioBuffer(bytes: ByteArray = null): void {
      if (bytes) {
        data = bytes;        
      }
      data.endian = Endian.LITTLE_ENDIAN;
    }
    
    /**
    * 
    */
    public function readAudio(position: int, samples: int, format: IAudioFormat): ByteArray {
      return new ByteArray();
    }

    /**
    * 
    */
    public function writeAudio(position: int, format: IAudioFormat, bytes: ByteArray): void {
      
    }
  }
}